package com.sg.zhui.visitor.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.canyinghao.canrefresh.CanRefreshLayout;
import com.canyinghao.canrefresh.classic.ClassicRefreshView;
import com.sg.zhui.visitor.R;
import com.sg.zhui.visitor.activity.ApplicationSuccessdActivity;
import com.sg.zhui.visitor.activity.IntoDoorApplyingForActivityTwo;
import com.sg.zhui.visitor.activity.LoginActivity;
import com.sg.zhui.visitor.adapter.ApplicationRecordAdapter;
import com.sg.zhui.visitor.bean.HomeCaseListBean;
import com.sg.zhui.visitor.utils.DensityUtil;
import com.sg.zhui.visitor.widget.OnRVItemClickListener;
import com.sg.zhui.visitor.widget.RecycleViewDivider;

import java.util.ArrayList;
import java.util.List;

//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.Unbinder;

/**
 * Created by chenlipeng on 2018/7/19 0019
 * describe:  申请记录页面
 */
public class ApplicationRecordFragment extends Fragment implements CanRefreshLayout.OnRefreshListener, CanRefreshLayout.OnLoadMoreListener, OnRVItemClickListener {


//    public Unbinder unbinder1;
//    @BindView(R.id.can_content_view)
//    RecyclerView canContentView;
//    @BindView(R.id.can_refresh_header)
//    ClassicRefreshView canRefreshHeader;
//    @BindView(R.id.can_refresh_footer)
//    ClassicRefreshView canRefreshFooter;
//    @BindView(R.id.refresh)
//    CanRefreshLayout refresh;
//    @BindView(R.id.rl_empty)
//    RelativeLayout rlEmpty;
//    @BindView(R.id.container)
//    LinearLayout container;
    private ApplicationRecordAdapter recommendAdapter;

    public ApplicationRecordFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View view = inflater.inflate(R.layout.application_record_layout, container, false);
//        unbinder1 = ButterKnife.bind(this, view);
//
//        recommendAdapter = new ApplicationRecordAdapter(canContentView);
//        canContentView.setLayoutManager(new LinearLayoutManager(getActivity()));
//        canContentView.addItemDecoration(new RecycleViewDivider(getActivity()));
//        canContentView.setAdapter(recommendAdapter);
//
//        recommendAdapter.setOnRVItemClickListener(this);
//
//        refresh.setOnLoadMoreListener(this);
//        refresh.setOnRefreshListener(this);
//        refresh.setMaxFooterHeight(DensityUtil.dp2px(getActivity(), 150));
//        refresh.setStyle(0, 0);
//        canRefreshHeader.setPullStr("下拉刷新");
//        canRefreshHeader.setReleaseStr("松开刷新");
//        canRefreshHeader.setRefreshingStr("加载中");
//        canRefreshHeader.setCompleteStr("");
//
//        canRefreshFooter.setPullStr("上拉加载更多");
//        canRefreshFooter.setReleaseStr("松开刷新");
//        canRefreshFooter.setRefreshingStr("加载中");
//        canRefreshFooter.setCompleteStr("");

//        List<HomeCaseListBean> listBeans = new ArrayList<>();
//        for (int i = 0; i < 4; i++) {
//            listBeans.add(new HomeCaseListBean());
//        }
//        recommendAdapter.setData(listBeans);
        return view;
    }

    @Override
    public void onRVItemClick(ViewGroup parent, View itemView, int position) {
//        Intent intent1 = new Intent(getActivity(), IntoDoorApplyingForActivity.class);
//        Intent intent1 = new Intent(getActivity(), LoginActivity.class);
//        Intent intent1 = new Intent(getActivity(), ApplicationSuccessdActivity.class);
        if (position == 0) {
            Intent intent1 = new Intent(getActivity(), LoginActivity.class);
            startActivity(intent1);
        } else if (position == 1) {
            Intent intent1 = new Intent(getActivity(), IntoDoorApplyingForActivityTwo.class);
            startActivity(intent1);
        }else if (position == 2) {
            Intent intent1 = new Intent(getActivity(), ApplicationSuccessdActivity.class);
            startActivity(intent1);
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
//        unbinder1.unbind();
    }

    @Override
    public void onRefresh() {
    }

    @Override
    public void onLoadMore() {
    }


}
